﻿
        function reloadGrid() {
            $('#tSortable').dataTable({
                "iDisplayLength": 5,
                "aLengthMenu": [5, 10, 25, 50, 100],
                "sPaginationType": "full_numbers",
                "iSortingCols": "STT"
            });
        }


        function Success(data)
        {
            if (data == "exist")
            {
                $.topAlertPopup({ "text": "", "typeAlert": "error" });
            }
            else
            {
                if (data != "") {
                    $.topAlertPopup({ "text": "Update completed", "typeAlert": "success" });
                    $('#ID').val(data.ID);
                    $('#Title').val(data.Title);

                    if (data.MerchantID != "0") {
                        var dataarray = data.MerchantID.split(",");

                        // Set the value

                        $(".chosen-select").val(dataarray);

                        // Then refresh

                       // $(".chosen-select").multiselect("refresh");
                    }
                    else {
                        $(".chosen-select").val("0");

                     //   $(".chosen-select").multiselect("refresh");
                    }

                    CKEDITOR.instances['Content'].setData(data.Content);
                    if (data.Active == false) {
                        $('#statussend').text('Not sent');
                        $('input[id=Active]').attr('checked', false);
                    }
                    else
                    {
                        $('input[id=Active]').attr('checked', true); $('#statussend').text('It had sent');
                    }
                 
                }
                else {
                    $.topAlertPopup({ "text": "Error, try agian please !", "typeAlert": "error" });
                }
            }
        }


       
